package com.woohua.thread.life;

/***
 * @title Counter
 * @description
 * @author woo hua
 * @version 1.0.0
 * @create 2023/3/10 13:18
 **/
public class Counter {

    private static int count;

    public synchronized static void increase() {
        count = count + 1;

        try {
            // 模拟并发争抢一个对象用
            Thread.sleep(2000);
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
    }

    public static int getCount() {
        return count;
    }
}
